package de.fh.ka.as.car.routing;

import java.util.ArrayList;

import android.graphics.Point;

public class Route {

	private ArrayList<Point> checkPoints= new ArrayList<Point>();

	private int previousCheckPoint=0;
	
	private int nextCheckPoint=1;
	
	
	public Route(ArrayList<Point> checkPoints) {
		super();
		this.checkPoints = checkPoints;
	}

	public Point getPreviousCheckPoint(){
		return checkPoints.get(previousCheckPoint);
	}
	
	public Point getNextCheckPoint(){
		if(hasNext()){
			nextCheckPoint++;
			return checkPoints.get(nextCheckPoint);	
		}else{
			return null;
		}
	}
	
	public boolean hasNext(){
		return nextCheckPoint+1 < checkPoints.size();
	}
	
	public void addNewPointBeforeNext(Point newCheckPoint){
		checkPoints.add(nextCheckPoint,newCheckPoint);
	}
}
